
const {ccclass, property} = cc._decorator;

@ccclass
export default class TipUi extends cc.Component {
    @property(cc.Node)
    tipNode:cc.Node=null;
    @property(cc.Label)
    tipLabel:cc.Label=null;
    public static instance:TipUi = null;
    onLoad () {
        TipUi.instance = this;
    };
    start () {
        this.tipNode.x = -10000;
        this.tipNode.opacity = 0;
    };
    showTip(msg) {
        this.tipLabel.string = msg;
        this.tipNode.x = 0;
        this.tipNode.stopAllActions();
        this.tipNode.runAction(cc.sequence(
            cc.fadeIn(0.1),
            cc.delayTime(1.5),
            cc.fadeOut(0.3),
            cc.callFunc(()=>{
                this.tipNode.x = 10000
            })
        ));
    };
}
